package CAT200;
import java.sql.*;
public class newDatabaseGallery 
{
	public static void main(String[] args)
	{
		createTableAndInsertData();
	}
	
	public static void createTableAndInsertData()
	{
		try
		{
			DriverManager.registerDriver(new org.apache.derby.jdbc.ClientDriver());
            Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/CAT200-DB", "user", "123");
            Statement stmt = con.createStatement();
            
            stmt.execute("create table GALLERY " +
            		"(" +
            		"PRODUCT_CODE varchar(10)," +
            		"P_DESCRIPTION varchar(500)," +
            		"P_QUANTITY integer," +
            		"P_PRICE double," +
            		"P_INDATE date," +
            		"P_COLOR varchar(10)," +
            		"P_SIZE char(2)," +
            		"P_LOCATION varchar(100)," +
            		"primary key(PRODUCT_CODE)" +
            		")");
            System.out.println("table inserted");
            //stmt.execute("insert into FEEDBACK values (1, 'can't sign in?', '2010-9-20', 'loki', 'welcome to the derby')");
            //System.out.println("values inserted");
		}
		catch(Exception e){ System.out.println(e);}
	}
}
